<?php

/**
 * Medias filter form base class.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseMediasFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'users_id'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'defis_id'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ordre'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'type'           => new sfWidgetFormChoice(array('choices' => array('' => '', 'image' => 'image', 'video' => 'video'))),
      'src'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'dailymotion_id' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'etat'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'users_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'defis_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'description'    => new sfValidatorPass(array('required' => false)),
      'ordre'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'type'           => new sfValidatorChoice(array('required' => false, 'choices' => array('image' => 'image', 'video' => 'video'))),
      'src'            => new sfValidatorPass(array('required' => false)),
      'dailymotion_id' => new sfValidatorPass(array('required' => false)),
      'etat'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('medias_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Medias';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'users_id'       => 'Number',
      'defis_id'       => 'Number',
      'description'    => 'Text',
      'ordre'          => 'Number',
      'type'           => 'Enum',
      'src'            => 'Text',
      'dailymotion_id' => 'Text',
      'etat'           => 'Number',
    );
  }
}
